/**
 * 
 */
package com.effectivsocial.web.controller;

import java.io.IOException;
import java.io.Serializable;

import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.inject.Named;

import lombok.Getter;
import lombok.Setter;

import org.springframework.context.annotation.Scope;



/**
 * @author Dhrubo
 * 
 */
@Named
@Scope("view")
public class LoginForm implements Serializable{
	private static final long serialVersionUID = 1L;
	
	@Getter @Setter
	private String email;
	
	@Getter @Setter
	private String password;
	
	public String doLogin() throws IOException {
		
		ExternalContext context = FacesContext.getCurrentInstance()
				.getExternalContext();

		context.dispatch("/j_spring_security_check?j_username="+email+"&j_password="+password);

		FacesContext.getCurrentInstance().responseComplete();
		// It's OK to return null here because Faces is just going to exit.
		return null;
	}

	
	
}
